#include <iostream>
#include <string>
#include <unordered_set>
using namespace std;
 
int main()
{
	int n = 0;
	while (cin >> n)
	{
		string id, op;
		unordered_set<string> s;
		size_t maxCon = 0;
		while (n--)
		{
			cin >> id >> op;
			if (op == "connect")
				s.insert(id);
			else
				s.erase(id);
			maxCon = max(maxCon, s.size());
		}
		cout << maxCon << endl;
	}
	return 0;
}